import request from "@/utils/request";
import type { RequestParams, ResponseData, groupRequestParams } from "./type";

// 分页列表
export const groupList = (data: RequestParams) => {
  return request<ResponseData<groupRequestParams>>({
    url: "/api/v1/group/page",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
export const addgroup = (data: groupRequestParams) => {
  return request<ResponseData<groupRequestParams>>({
    url: "/api/v1/group/add",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
export const delgroup = (id: number) => {
  return request<ResponseData<groupRequestParams>, any>({
    url: "/api/v1/group/delete",
    method: "post",
    data: id,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
export const Formgroup = (id: number) => {
  return request<ResponseData<groupRequestParams>>({
    url: "/api/v1/group/form",
    method: "post",
    data: id,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};

export const groupOptions = (aesKeyByRsa: string) => {
  return request<ResponseData<any>>({
    url: "/api/v1/group/options",
    method: "post",
    data: aesKeyByRsa,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
export const updategroup = (data: groupRequestParams) => {
  return request<ResponseData<groupRequestParams>>({
    url: "/api/v1/group/update",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
export const BookshelfOptions = (aesKeyByRsa: string) => {
  return request<ResponseData<any>>({
    url: "/api/v1/bookshelf/options",
    method: "post",
    data: aesKeyByRsa,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
